<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h2>我是ejs模板引擎</h2>

  <h3>绑定数据</h3>
  <p><%=userInfo.username%> -- <%=userInfo.age%></p>
  <%-article%>

  <h3>条件判断</h3>
  <%if(flag === true){%>
    <strong>flag=true</strong>
  <%}%>
  <%if(score >= 60){%>
    <strong><%=score%>及格</strong>
  <%} else {%>
    <strong><%=score%>不及格</strong>
  <%}%>

  <h3>循环遍历</h3>
  <ul>
    <%for(var i=0;i<list.length;i++){%>
      <li><%=list[i]%></li>
    <%}%>
  </ul>
  <ul>
    <%for(var i=0;i<articleList.length;i++){%>
      <li><%=articleList[i].username%> -- <%=articleList[i].age%></li>
    <%}%>
  </ul>
  <%-include('footer.ejs')%>
</body>
</html>